<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <!--[if lt IE 9]>
    <script type="text/javascript" src="../../../lib/html5shiv.js?rev=@@hash"></script>
    <script type="text/javascript" src="../../../lib/respond.min.js?rev=@@hash"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="../../../static/h-ui/css/H-ui.min.css"/>
    <link rel="stylesheet" type="text/css" href="../../../static/h-ui.admin/css/H-ui.admin.css"/>
    <link rel="stylesheet" type="text/css" href="../../../lib/Hui-iconfont/1.0.8/iconfont.css"/>
    <link rel="stylesheet" type="text/css" href="../../../static/h-ui.admin/skin/default/skin.css" id="skin"/>
    <link rel="stylesheet" type="text/css" href="../../../static/h-ui.admin/css/style.css"/>
    <link rel="stylesheet" type="text/css" href="../../../ht-css/Project.css"/>
    <!--表单验证-->
    <link rel="stylesheet" type="text/css" href="../../../lib/Validform/5.3.2/style.css" />
    <!--[if IE 6]>
    <script type="text/javascript" src="../../../lib/DD_belatedPNG_0.0.8a-min.js?rev=@@hash"></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="../../../ht-css/style-q.css"/>
    <title></title>
</head>
<body>

  <div class="cl clearfix pl-20 pt-15">        
        <div class="formControls f-l">
            <input type="text" class="input-text  radius size-S" placeholder="请输入SPU编码" id="searchInput" name="" oninput="value=value.replace(/[^\d]/g,'')">
        </div>
        <div class="formControls f-l">
            <button class="btn btn-primary radius size-S ml-10" id="searchSpu">&nbsp;&nbsp;搜索&nbsp;&nbsp;</button> 
        </div>
    </div>
   <div class="cl clearfix pl-20 pr-20 pt-15">
       <table class="table table-border table-bg table-sort mt-5">
           <thead>
                <tr><th>SPU编码</th><th>图片</th><th>名称</th><th>商品区域</th></tr>
           </thead>
           <tbody id="searchResult">
                <tr><td colspan="4">暂无商品</td></tr>
           </tbody>
           
       </table>
   </div>
    
    <div class="text-c pd-20">
        <button class="btn btn-primary radius" type="buttom" id="saveSpu">&nbsp;&nbsp;确认&nbsp;&nbsp;</button>       
    </div>

</body>
<script type="text/javascript" src="../../../lib/jquery/1.9.1/jquery.min.js?rev=@@hash"></script>
<script type="text/javascript" src="../../../lib/layer/2.4/layer.js?rev=@@hash"></script>
<script type="text/javascript" src="../../../static/h-ui/js/H-ui.min.js?rev=@@hash"></script>
<script type="text/javascript" src="../../../static/h-ui.admin/js/H-ui.admin.js?rev=@@hash"></script>
<script src="../../../ht-js/public.js?rev=@@hash"></script>
<!--验证token-->
<script src="../../../ht-js/verifyToken.js?rev=@@hash"></script>
<script src="../../../ht-js/Project.js?rev=@@hash"></script>
<style>
    .spu_img{display: inline-block;width: 50px;height: 50px;}
</style>
<script>
 

    var curSpuCode = '';
    function searchSpu(id){
        web.doAjax(root.inter.getSpuBySpuCode, 'post', {spuCode:id}, function(data){
           if(data.errorCode == 0 && data.data){ 
                var trHtml = '';
                var curInfo = data.data;
                curSpuCode = curInfo.spu_code;
                trHtml+='<tr><td><input class="f-l mr-10 spu_s_c" type="checkbox" style="margin-top:5px"> '+curInfo.spu_code+'</td><td><img class="spu_img" src="'+curInfo.img_url+'"/></td><td>'+curInfo.name+'</td><td>'+curInfo.area_name+'</td></tr>';
                $('#searchResult').html(trHtml);
           }else{
            layer.msg('此SPU有误，请重新输入', {icon: 1, time: 1000}); 
           }
        });
    }

    $('#searchSpu').on('click',function(){
        var curV = $('#searchInput').val();
        if(curV.length>0){
            searchSpu(curV);
        }
    });

    $('#saveSpu').on('click',function(){
         if($('.spu_s_c').is(':checked')){
            parent.spcialLinkConfit.spuIdSubmit(getQueryString('index'),curSpuCode); 
            var index = parent.layer.getFrameIndex(window.name);
            parent.layer.close(index);         

         }else{
            layer.msg('请选择商品', {icon: 1, time: 1000}); 
         }
    })
    
</script>
</html>